package com.pan.domain.invariability;

import com.pan.utils.ApplicationConfig;

import java.util.Set;

public class GlobalInformation {

    private static int originX ;
    private static int originY ;


    static {
        int[] originXY = ApplicationConfig.INSTANCE.getOriginXY();
        originX = originXY==null?0:originXY[0];
        originY = originXY==null?0:originXY[1];
    }



    public static int getRelativeOriginX(int x){
        return x-originX;
    }

    public static int getRelativeOriginY(int y){
        return y-originY;
    }

    public static int[] getRelativeOriginXY(double x,double y){
        return new int[]{getOriginX(), getOriginY()};
    }

    public static int getOriginX() {
        return originX;
    }

    public static void setOriginX(int originX) {
        GlobalInformation.originX = originX;
    }

    public static int getOriginY() {
        return originY;
    }

    public static void setOriginY(int originY) {
        GlobalInformation.originY = originY;
    }

    public  static void setOriginXY(int originX,int originY){
        setOriginX(originX);
        setOriginY(originY);
    }

    public static String getOriginXYString(){
        return "Origin: x,y = ["+originX+", "+originY+"]";
    }
}
